<template>
    <div class="">
        <div class="crumbs">
            <el-breadcrumb separator="/">
                <el-breadcrumb-item><i class="el-icon-lx-copy"></i>所有客户</el-breadcrumb-item>
            </el-breadcrumb>
        </div>
        <div class="container">
            <el-table
            :data="tableData"
            style="width: 100%">
            <el-table-column
                prop="name"
                label="客户名称"
                width="180">
            </el-table-column>
            <el-table-column
                prop="addr"
                label="公司地址"
                width="180">
            </el-table-column>
            <el-table-column
                prop="username"
                label="联系人">
            </el-table-column>
            <el-table-column
                prop="phone"
                label="联系人电话">
            </el-table-column>
            <el-table-column
                label="操作">
                <template slot-scope="scope">
                    <el-button type="text" @click="del(scope.row.id)">删除</el-button>
                </template>
            </el-table-column>
            </el-table>
            
        </div>
    </div>
</template>

<script>
import { DelCustomer,ShowCustomer } from '../../api/api.js'
    export default {
        inject:['reload'],
        name: 'allCargo',
        data() {
            return {
                uid:localStorage.getItem('uid'),
                tableData:[],

            }
        },
        methods: {
            
            del(id){
                let params = {
                    cid:id
                }
                DelCustomer(params).then(res=>{
                    this.$message(res.data.message)
                    this.reload()
                })
            },
        },
        computed: {
            
        },
        mounted(){
            ShowCustomer().then(res=>{
                this.tableData = res.data
            })
        }
    }

</script>

<style>
.message-title{
    cursor: pointer;
}
.handle-row{
    margin-top: 30px;
}
</style>

